<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<title>头部</title>
	    <link rel="stylesheet" href="/pc-static/css/iconfont.css"> 
		<script type="text/javascript" src="/js/jq.js"></script>
		<script type="text/javascript" src="/js/global.js"></script> 
  <style>
    .spinner-win {
      position: fixed;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      z-index: 10000;
      background: rgba(0, 0, 0, 0.9);
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .tit {
    position: relative;
}

    .spinner {
      display: flex;
      flex-direction: row;
    }

    .spinner div {
      background-color: #FFFFFF;
      height: 100%;
      width: 6px;
      height: 50px;
      -webkit-animation: stretchdelay 1.2s infinite ease-in-out;
      animation: stretchdelay 1.2s infinite ease-in-out;
    }
    
    .red{
    	color:red !important;
    }

    .spinner div + div {
      margin-left: 10px;
    }

    .spinner .rect2 {
      -webkit-animation-delay: -1.1s;
      animation-delay: -1.1s;
    }

    .spinner .rect3 {
      -webkit-animation-delay: -1.0s;
      animation-delay: -1.0s;
    }

    .spinner .rect4 {
      -webkit-animation-delay: -0.9s;
      animation-delay: -0.9s;
    }

    .spinner .rect5 {
      -webkit-animation-delay: -0.8s;
      animation-delay: -0.8s;
    }

     @-webkit-keyframes stretchdelay {
      0%, 40%, 100% {
        -webkit-transform: scaleY(0.4)
      }
      20% {
        -webkit-transform: scaleY(1.0)
      }
    }

    @keyframes stretchdelay {
      0%, 40%, 100% {
        transform: scaleY(0.4);
        -webkit-transform: scaleY(0.4);
      }
      20% {
        transform: scaleY(1.0);
        -webkit-transform: scaleY(1.0);
      }
    } 
  </style>
 
 <link href="/pc-static/css/header.css" rel="stylesheet">
</head>

<body>
    <div class="tool_bar">
        <div class="main">
            <div class="left welcome"></div>
            <div class="right top_bar_nav">
                <ul>
                  <li class="top_bar_nav color_switch" style="display: none;">
                    <a target="_blank" id="color_switch" class="color_switch" style="display: none;">
                      快速充值通道
                    </a>
                  </li>
                  <li class="color_switch" style="display: none">|</li>
                  <li class="top_bar_nav free_play">
                    <a id="free_play">免费试玩</a>
                  </li>
                  <li>|</li>
                  <li class="top_bar_nav speciaLogin" style="display: none;">
                    <a class="speciaLogin" id="speciaLogin">特殊代理登录</a>
                  </li>
                  <li class="speciaLogin " style="display: none;">|</li>
                  <li class="top_bar_nav">
                    <a id="proxyReg" class="agency">加入代理</a>
                  </li>

                  <li>|</li>
                  <li class="top_bar_nav ">
                    <a class="AddFavorite" onclick="AddFavorite(window.location,document.title)" href="javascript:void(0)">加入收藏</a>
                  </li>
                  <li>|</li>
                  <li class="top_bar_nav ">
                    <a href="/pc/help.do" target="parent">帮助中心</a>
                  </li>
                  <li>|</li>
                  <li class="top_bar_nav ">
                    <a href="/pc/rule.do?cname=2fssc" target="blank">玩法</a>
                  </li>
                </ul>
            </div>
        </div>
    </div>
    <div class="special_agent_login_win">
      <div class="login_area">
        <div class="title">
          <span>特殊代理登录</span>
          <i class="iconfont icon-guanbi " id="specialAgent"></i>
        </div>
        <div class="login_form">
          <div class="row">
            <div class="left">
              <span>用户名</span>
            </div>
            <div class="right">
              <input placeholder="请输入用户名" id="specialAgentName">
            </div>
          </div>
          <div class="row">
            <div class="left">
              <span>登录密码</span>
            </div>
            <div class="right">
              <input type="password" placeholder="请输入登录密码" id="specialAgentPwd">
            </div>
          </div>
          <div class="row">
            <div class="left">
              <span>验证码</span>
            </div>
            <div class="right">
              <input placeholder="请输入验证码" class="verify_code_input" id="specialAgentVerifyCode">
              <div class="verify_code" id="specialAgentVerifyCodeImg">

              </div>
              <span class="switch">
              换一张
            </span>
            </div>
          </div>
          <div class="login_btn">
            <button id="specialAgentLoginBtn">立即登录</button>
          </div>
        </div>
      </div>
    </div>
<div class="header">
  <div class="main">
    <div class="left logo">
      <a href="/pc/index.do" class="logo-link" target="_parent">
        <img width="227px" height="68px" alt="" src="">
      </a>
    </div>
    <div class="right login_and_userinfo">
    </div>
  </div>

</div>

<div class="nav">
  <!--导航 Start-->
  <div class="menu">
    <div class="nav">
      <ul class="clearfix" id="headNav" style="">
        <li><a href="/pc/index.do" class="index active" target="_parent">首页</a></li>
        <li>
          <a href="/pc/lotter.do" class="gc" target="_parent">购彩大厅</a>
        </li>
        <li>
         	<a class="dg" style='cursor:pointer' target="_parent" id="bjl">百家乐</a>
        	<!-- <a>棋牌</a>
        	 <span class="subnav">
	          </span> -->
         <!--  <ul class='chess'>
          	<li>
          		<a href="pc/bjl.do" target="_parent">百家乐</a>
          	</li>
          </ul> -->
        </li>
        <li class="tit">
          <a href="/pc/mobilegc.do" class="mbgc" target="_parent">
          	<i class="icon_nav_new" style='bottom: 25px;' ></i>手机购彩
          </a>
        </li>
        <li class="tit">
        	<a href="/pc/activity.do" style="position: relative;" class="activity" target="_parent">
          		<i class="icon_nav_new" ></i>优惠活动
           </a>
        </li>
        <li><a href="/pc/drawdetail.do" class="draw" target="_parent">开奖公告</a></li>
        <li><a href="/pc/trendChart.do?cname=2fssc" class="trend" target="_parent">走势图表</a></li>
        <li><a class="agency" target="_parent">加入代理</a></li>
        <li><a href="/pc/rule.do?cname=2fssc" class="rules" target="_parent">玩法规则</a></li>
        <li class="nav_qq"><a id="qq_service" class="qq_service"></a></li>
      </ul>
    </div>
  </div>
  <div class="header_error" style="display:none;">
    <span id="header_error_msg"></span>
  </div>
</div>
<script type="text/javascript">

	window.onload = function() {   //页面 加载完成时（父页面获取子页面元素）
		/* getAllPcNotice(); */
		$.post('/title.do',{},function(data){
			var title = data.data
			if(parent.$('#pc_notice').length==1){
				parent.$('#pc_notice').text(title.notice)
			}
			if(parent.$('#headerBox').length==1){
				parent.$('#headerBox').text(title.notice)
			}
			$(".logo-link img").attr("src","/d/cp/"+title.logo)
			$(".welcome").text(title.pc_welcome)
			if(parent.$("#footer").contents().find(".footer-qr-head img").length==1){
				parent.$("#footer").contents().find(".footer-qr-head img").attr("src","/d/cp/"+title.logo)
				parent.$("#footer").contents().find(".footer-qr-img img").attr("src","/d/cp/"+title.pc_wechat)
			}
		});
	}

	//如果父页面是注册页面
	$(function(){
	loginState();
	if(window.parent.document.getElementById("code")==null){
		$(".code")[1].src="/u/code.do";
		$(".code")[1].style.display="block"
	} else{
		$(".code")[1].src="";
		$(".code")[1].style.display="none"
	    $("#login_code_input").attr("disabled","disabled");
		$("#password").attr("disabled","disabled");
		$("#username").attr("disabled","disabled");
		$("#login_button1").attr("disabled","disabled");
		$("#login_button1").css("background","#609cbf");
		$("#login_button1").css("cursor","not-allowed")  
	} 
 	$('#YZcode').click('on',getCode);
 	$('#login_button1').click('on',login);
 	$("#userLogout").on("click",exit);
	$("#register").click("on",register);
});

$("#headNav li a").on("click",function(){
	if($(this).hasClass("qq_service")){
		return;
	}
	$(".active").removeClass("active")
	localStorage.setItem("act",$(this).attr("class"))
	$(this).addClass("active") 
})
 $("#headNav li a.active").removeClass("active")
$("."+localStorage.getItem("act")).addClass("active") 
function loginState(){
	var login_form = $('.login_and_userinfo');
	var logins = "<div class='logined' style='display: none;'>"
		+"<em>您好，</em><span class='username' id='usernameShow'></span>"
		+"<em>可用余额：</em><span class='money' id='moneyShow'></span>"
		+"<a onclick='window.location.reload()' id='refreshBalance'>刷新</a><i></i>"
		+"<a class='user_center' href='/pc/personal.do?type=user-center' target='_parent'>用户中心</a><i></i>"
		+"<a class='red user_goto_recharge' href='/pc/personal.do?type=chooseGroup'  style='display: none;color:red;' target='_parent'>充值</a>"
		+"<i class='isTry' style='initial'></i>"
		+"<a class='user_goto_withdraw' href='/pc/personal.do?type=withdraw' style='display: none;' target='_parent'>提现</a>"
		+"<i class='isTry' style='initial'></i>"
		+"<a href='/pc/personal.do?type=transactionRecord' target='_parent'>投注记录</a><i></i><a id='userLogout'>退出</a></div>";
     logins +="<div class='login' style='display: block;'><div id='login_form'><div class='username left'><i class='iconfont icon-xingmingyonghumingnicheng'></i>"
      	+"<input type='text' placeholder='用户名' name='user_name' id='username'></div><div class='password left'><i class='iconfont'>&#xe62d;</i>"
      	+"<input type='password' placeholder='密码' name='password' id='password' autocomplete='new-password'></div><div class='code left'>"
      	+"<input type='text' size='4' name='verify_code' placeholder='验证码'   id='login_code_input' style='padding-left:74px;padding-right:10px;width:42px;'>"
      	+"<img class='code' id='YZcode' alt='点击刷新' title='点击刷新' style='position: absolute;left:5px;top:8.5px;display: none;line-height: 37px;'/></div>"
      	+"<button type='button' class='left btn-default login-btn btn' name='login' id='login_button1'>登录</button></div>"
      	+"<button type='button' class='left d-btn reg-btn btn' name='register' id='register'>注册</button></div>";
	login_form.html(logins);
	if(''!='${user}'){
		$('#usernameShow').text('${user.name}');
		$('#moneyShow').text('${user.balance}');
		$('.login')[0].style.display="none";
		$('.logined')[0].style.display="block";
		$.ajax({
			url: "/users/userInfos.do",
			type: "post",
			data: {},
			success: function(data) {
				$("#moneyShow").text(data.data.balance)
				$(".agency").on("click",function(){
					if(data.data.state==2){
						PrentLayerLittle("提示：", '请先成为正式会员')
					}else if(data.data.state==1){
					 	parent.location.href="pc/personal.do?type=agentExplain" 
					}else{
					}
				})
				
				
				if(data.data.state==2){  //免费试玩
					$(".isTry")[0].style.display="initial"
					$(".isTry")[1].style.display="initial"
					$(".user_goto_recharge")[0].style.display="none"
					$(".user_goto_withdraw")[0].style.display="none"
				}else{  //用户登录
					$(".isTry")[0].style.display="inline-block"
					$(".isTry")[1].style.display="inline-block"
					$(".user_goto_recharge")[0].style.display="inline"
					$(".user_goto_withdraw")[0].style.display="inline"
				}
			}
		})
	}else{
		$(".agency").on("click",function(){
			PrentLayerLittle("提示：", '请先登录')
		})
	}
} 

 function register(){
	 window.parent.location.href ="/pc/register.do"
}  

function getCode(){
	$(".code").attr("src","u/code.do?"+Math.random());
}

function login(){
	if(window.parent.document.getElementById("code")!=null){
		return;
	}
	var name = $('#username').val();
	var pass = $('#password').val();
	var code = $('#login_code_input').val();
	if(''==name){
		 PrentLayerLittle("提示：", '请输入账号')
		$('#specialAgentName').val('');
		$('#specialAgentPwd').val('');
		return false;
	}
	if(''==pass){
		PrentLayerLittle("提示：", '请输入密码')
		return false;
	}
	if(''==code){
		PrentLayerLittle("提示：", '请输入验证码')
		return false;
	}
	$.post('/u/login.do',{name:name,pass:pass,code:code},function(result){
		if(result.message==4){
			//登录成功
			PrentLayerLittle("提示","登录成功")
			 setTimeout(function () {
			 	window.location.reload(); 
			}, 1000);
		}else if(result.message==1){
			//验证码输入错误  请重新输入
			PrentLayerLittle("提示：", "验证码输入错误请重新输入")
		}else if(result.message == 0){
			//请重新刷新验证码
			PrentLayerLittle("提示：", "请重新刷新验证码")
		}else if(result.message == 2){
			//账号已被禁用 请联系客服人员
			PrentLayerLittle( "提示：", "账号已被禁用请联系客服人员")
		}else if(result.message == 3){
			//该ip被禁用，请更换ip重新登录
			PrentLayerLittle( "提示：", "该ip被禁用请更换ip重新登录")
		}else if(result.message == 5){
			//账号或密码错误请重新输入
			PrentLayerLittle("提示：", "账号或密码错误请重新输入")
		}
	});
}



function exit(){
	$.post('/pc/exit.do',{},function(result){
		$(".login")[0].style.display="block";
		$(".logined")[0].style.display="none";
		window.location.reload();
	});
}

function AddFavorite(sURL, sTitle) {
    sURL = encodeURI(sURL); 
try{   
    window.external.addFavorite(sURL, sTitle);   
}catch(e) {   
    try{   
        window.sidebar.addPanel(sTitle, sURL, "");   
    }catch (e) {   
        alert("加入收藏失败，请使用Ctrl+D进行添加,或手动在浏览器里进行设置.");
    }   
}
}


$("#bjl").on("click",function(){
	$.ajax({
		url: "/u/panduanshifudenglu.do",
		type: "post",
		data: {},
		success: function(data) {
			if(data.data==0){
				PrentLayerLittle("提示：", '请先登录')
			}else{
				parent.location.href="/pc/bjl.do"
			}
		}
	})
})
</script>
</body>
</html>